package com.xyoto.community.controller;

import com.xyoto.community.dto.DeleteQuestionCommentReplyDTO;
import com.xyoto.community.dto.SaveQuestionCommentReplyDTO;
import com.xyoto.community.service.QuestionCommentReplyService;
import com.xyoto.community.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

//@RestController
@RequestMapping("/topic")
@Api(value = "问答评论回复（前台）", tags = "问答评论回复（前台）")
public class QuestionCommentReplyController {

    @Autowired
    private QuestionCommentReplyService replyService;

    @ApiOperation(value = "新增问答评论回复（前台）", notes = "新增问答评论回复（前台）")
    @PostMapping("/saveQuestionCommentReply")
    public Result saveQuestionCommentReply(@RequestBody @Validated SaveQuestionCommentReplyDTO replyDTO){
        return replyService.saveQuestionCommentReply(replyDTO);
    }

    /**
     * 删除问答评论回复
     * @param deleteQuestionCommentReplyDTO 回复id
     * @return
     */
    @ApiOperation("删除问答评论回复")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "questionCommentReplyId" ,value = "问答评论回复id",required = true)
    })
    @DeleteMapping("/deleteQuestionCommentReply")
    public Result removeQuestionCommentReply(@RequestBody DeleteQuestionCommentReplyDTO deleteQuestionCommentReplyDTO){
        return replyService.removeQuestionCommentReply(deleteQuestionCommentReplyDTO.getQuestionCommentReplyId());
    }

}
